<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>个人信息系统11</title>
    <style>
        .wrap {
            margin-top: 150px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="wrap">
    <div id="userName"></div>
    <button id="btnLogout">登出</button>
</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="/js-cookie.js"></script>

<script>
    $(document).ready(function () {
//                $.ajax({
//                    url: '/profile',
//                    type: 'GET',
//                    dataType: 'json',
//                    success: function (res) {
//                        $('#userName').html(res.userName);
//                    }
//                })
        $.ajax({
            url: 'http://wthrcdn.etouch.cn/weather_mini?citykey=101210701',
            type: 'GET',
            dataType: 'json',
            success: function (res) {
                console.log(res);
                $('#userName').html(res.data.city+res.data.wendu+","+res.data.ganmao);
            }
        })
        $('#btnLogout').click(function () {
            $.ajax({
                url: 'http://localhost:63343/last2/loginout.php?_ijt=t3kk6mq83qqhupviva6mi3bnqe',
                type: 'GET',
                contentType: 'application/json;charset=utf-8',
                success: function (res) {
                    if (res.message === 'success') {
                        location.href = './login.html';
                    }
                }
            })
        })
    })
</script>
</body>
</html>
